package cn.com.anypay.manager.payment.core;

/**
 * 支付产品异常类
 *
 * 处理支付产品相关的异常情况
 *
 * @author AnyPay Team
 * @version 1.0
 * @since 2025-07-05
 */
public class PaymentProductException extends Exception {

    private static final long serialVersionUID = 1L;

    /**
     * 错误代码
     */
    private String errorCode;

    /**
     * 错误消息
     */
    private String errorMessage;

    /**
     * 渠道ID
     */
    private String channelId;

    /**
     * 产品类型
     */
    private String productType;

    public PaymentProductException(String errorCode, String errorMessage) {
        super(errorMessage);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public PaymentProductException(String errorCode, String errorMessage, String channelId, String productType) {
        super(errorMessage);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
        this.channelId = channelId;
        this.productType = productType;
    }

    public PaymentProductException(String errorCode, String errorMessage, Throwable cause) {
        super(errorMessage, cause);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public PaymentProductException(String errorCode, String errorMessage, Throwable cause, String channelId, String productType) {
        super(errorMessage, cause);
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
        this.channelId = channelId;
        this.productType = productType;
    }

    // Getters
    public String getErrorCode() {
        return errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public String getChannelId() {
        return channelId;
    }

    public String getProductType() {
        return productType;
    }

    @Override
    public String toString() {
        return "PaymentProductException{" +
                "errorCode='" + errorCode + '\'' +
                ", errorMessage='" + errorMessage + '\'' +
                ", channelId='" + channelId + '\'' +
                ", productType='" + productType + '\'' +
                '}';
    }
}